<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<text class="">{{  $t('YXH') }}</text>
		<button class="target" type="default" @tap="actionSheetTap">{{ $t('switch') }}</button>
		<!-- 底部选项卡 -->
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				modalLang: null,
			}
		},
		onLoad() {
			const res = uni.getSystemInfoSync()
			console.log("res.language", res.language)
		},
		methods: {
			actionSheetTap() {
				const that = this
				uni.showActionSheet({
					title:'标题',
					itemList: ['System', 'English', '中文', '日本語'],
					success: (e) => {
						console.log(e.tapIndex);
						if(e.tapIndex === 0){
							const res =  uni.getSystemInfoSync()
							this.$i18n.locale = res.language
							// this.$cache.set("_lang", 'System', 0)
						}else if(e.tapIndex === 1){
							// this.$cache.set('_lang', 'en', 0)
							this.$i18n.locale = 'en'
						}else if (e.tapIndex === 2) {
							// this.$cache.set('_lang', 'zh-CN', 0)
							this.$i18n.locale = 'zh-CN'
						}
						else if (e.tapIndex === 3) {
							// this.$cache.set('_lang', 'jpn', 0)
							this.$i18n.locale = 'jpn'
						}
					}
				})
			},
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
